﻿<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Guardianes - Greenpeace</title>
    <link href="css/ew.css" rel="stylesheet" />
    <style type="text/css">
        html, body {
            height: 100%;
            overflow: hidden;
        }

        body {
            padding: 0;
            margin: 0;
        }

        #silverlightControlHost {
            height: 100%;
            text-align: center;
        }
    </style>
    <script type="text/javascript" src="Silverlight.js"></script>
    <script src="Scripts/jquery-1.6.4.js"></script>
    <script type="text/javascript">
        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
                appSource = sender.getHost().Source;
            }

            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;

            if (errorType == "ImageError" || errorType == "MediaError") {
                return;
            }

            var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n";

            errMsg += "Code: " + iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError") {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError") {
                if (args.lineNumber != 0) {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " + args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }

            alert(errMsg);
        }
    </script>
</head>
<body scroll="no">
    <form id="form1" runat="server" style="height: 100%">
        <div id="silverlightControlHost">
            <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
                <param name="source" value="ClientBin/Earthwatchers.UI.xap?v=1.103" />
                <param name="onError" value="onSilverlightError" />
                <param name="background" value="white" />
                <param name="minRuntimeVersion" value="5.0.61118.0" />
                <param name="autoUpgrade" value="true" />
                <param name="initParams" value="credentials=<%= Request["username"] + ":" + Request["password"] + ":" + Request["geohexcode"] %>" />
                <div class="floater">
                    <div class="contents">
                        <div>
                            <img src="Images/logo.png" />
                        </div>
                        <div style="margin-top: 15px">
                            <img src="Images/guardianes.png" />
                        </div>
                        <div class="container">
                            <div id="logindiv">

                                <div class="content">
                                    <div class="slHeader">
                                        Estás a punto de convertirte en Guardián!
                                    </div>
                                    <div class="slText">Instalá el plugin the Microsoft Silverlight, sólo lleva unos segundos</div>
                                    <div style="margin-top: 30px">
                                        <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration: none" class="button">INSTALAR SILVERLIGHT</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </object>
            <iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px; border: 0px"></iframe>
        </div>
        
        <script>
            function shorten(url) {
                var access_token = 'c31a6068bb170d6b9c50ac625c59e25888abb0e0';
                var api_req = 'https://api-ssl.bitly.com/v3/shorten?access_token=' + access_token + '&longUrl=' + encodeURIComponent(url);
                var res = null;

                $.ajax({
                    dataType: "json",
                    async: false,
                    url: api_req,
                    success: function (result) {
                        res = result.data.url;
                    }
                });

                return res;
            }
        </script>
    </form>
</body>
</html>
